import request from '/@/utils/request';

export function menuApi() {
	return {
		getMenuListTree() {
			return request({
				url: '/system/resource/getResourceTreeList',
				method: 'get'
			})
		},
		getMenuList() {
			return request({
				url: '/system/resource/getMenuList',
				method: 'get'
			})
		},
		
		getUserMenu() {
			return request({
				url: '/system/resource/getRouterList',
				method: 'get'
			})
		},
		
		getRoleMenu(data:Object) {
			return request({
				url: '/system/resource/getResourceIdListByRoleId',
				method: 'get',
				params: data
			})
		},
		
		save(data:Object) {
			return request({
				url: '/system/resource/save',
				method: 'post',
				data
			})
		},
		
		update(data:Object) {
			return request({
				url: '/system/resource/update',
				method: 'post',
				data
			})
		},
		
		
		// 删除菜单
		del(id:string) {
			return request({
				url: '/system/resource/delete',
				method: 'post',
				data:{id:id}
			})
		},
	};
}
